#ifndef   EMAES_H
#define   EMAES_H

#ifdef    STM32
/// For stm32, we place the template buffer to the unreachable memory
extern unsigned char *sBox; //!< Final location of s-box.
extern unsigned char *sBoxInv; //!< Final location of inverse s-box.
#else
/// For other platform, just allocate in the stack memory
extern unsigned char block1[ 256 ]; //!< Workspace 1.
extern unsigned char block2[ 256 ]; //!< Worksapce 2.
#endif

extern void aesEncrypt( unsigned char * buffer, unsigned char * chainBlock );
extern void aesEncInit( void );
extern void aesDecrypt( unsigned char * buffer, unsigned char * chainBlock );
extern void aesDecInit( void );
extern unsigned char kTable[32];


extern unsigned long Crc32Table[256];
void MakeCrc32Table();
unsigned long  CalcCrc32(const unsigned char* data, unsigned long size);
void MakeCrc32TableRev();
unsigned long  CalcCrc32Rev(const unsigned char* data, unsigned long size);

unsigned long CrcGen_STM32(unsigned long data[], unsigned long size);

#endif

